home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
B-Business
/
(c)b4.d64
/
c64 book sort.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
9KB
|
307 lines
10 POKE 53281,1
20 GOSUB 1560
30 REM COM-64 BOOK SORT BY PATRICK GROTE 11706 DEVONSHIRE AVE. ST.LOUIS,MO63131
40 PRINTCHR$(142):POKE 53281,0:POKE 53280,6:POKE 664,1
50 POKE 36879,93:READR$,R:FORI=1TOR:READO$(I):NEXT:DATA"COM-64 BOOK SORT "
60 DATA8,"TITLE","AUTHOR(S)","I.S.B.N. NUMBER","CATALOG NUMBER"
70 DATA "SHORT DESCRIPTION","PRICE (IF APPLICABLE","PUBLISHER","RATING"
80 PRINT"[147][176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]":PRINT"[221]" R$" [221]":PRINT"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
90 PRINT"1. ADD BOOK":PRINT"2. REMOVE A BOOK":PRINT"3. SEARCH FOR A BOOK"
100 PRINT"4. EXAMINE A BOOK":PRINT"5. CHANGE A BOOK":PRINT"6. SAVE NEW DATA"
110 PRINT"7. PRINT FILES":PRINT"8. END"
120 RESTORE:PRINT" WHICH DO YOU WANT?"
130 GETA$:IFA$=""THEN 130
140 IFA$<"1"ORA$>"8"THEN 130
150 READB$:IFB$<>"[220]"THEN 140
160 A=VAL(A$):ONA GOTO 180,230,260,360,430,440,460,450
170 POKE198,10:FORI=0TO9:POKE631+I,13:NEXT:END
180 READA$:IFA$<>"[166]"THEN 180
190 READA:PRINT"[147]INPUT 0 FOR UNKNOWNS"
200 PRINT"ITEM : "A"":FORI=1TOR:PRINTO$(I):INPUTW$(I):PRINT:IFW$(1)=""THEN 80
210 NEXT:W$(0)="XX"+CHR$(34)+","+STR$(A):Z=A*10+500:K=0:PRINT"[147]"
220 FORI=Z TOZ+R:PRINTI;"DATA"CHR$(34)W$(K):K=K+1:NEXT:PRINT"RUN30":GOTO 170
230 B$="":PRINT"[147]WHICH ITEM TO REMOVE":INPUTB$:IFVAL(B$)=0THEN80
240 PRINT "[147]":Z=VAL(B$)*10+500:PRINTZ"DATA"CHR$(34)"[166]"CHR$(34)","VAL(B$)
250 FORI=Z+1TOZ+R:PRINTI:NEXT:PRINT"RUN8":GOTO 170
260 INPUT"[147]SEARCH FOR ";B$:IFB$=""THEN80
270 H=0:READA$:IFA$="END"THEN 80
280 IF A$="[166]"THEN READA:GOTO 270
290 READA:FORI=1TOR:READA$(I):IFLEFT$(A$(I),LEN(B$))=B$THEN H=1
300 NEXT:IFH=0THEN 270
310 PRINT"[147]ITEM : "A"":FORI=1TOR:PRINT" "A$(I):NEXT:IFW=1THENRETURN
320 PRINT"HIT ANY KEY TO PROCEED"
330 GETA$:IFA$=""THEN330
340 IFQ=1THEN RETURN
350 GOTO270
360 A$="":INPUT "[147]WHICH ITEM ";A$:IFA$="."THEN 80
370 A=VAL(A$):IFA=0THEN80
380 READA$:IFA$="END"THEN80
390 IFA<>VAL(A$)THEN 380
400 READ A$(1):IFA$(1)="[166]"THEN80
410 FORI=2TOR:READA$(I):NEXT:Q=1:GOSUB310:Q=0:IFW=1THEN RETURN
420 GOTO 80
430 W=1:GOSUB360:W=0:PRINT"[147]":FORI=1TOR:INPUTW$(I):GOTO 210
440 PRINT"[147]":SAVE"@0:"+R$,8:END
450 END
460 PRINT"[147] PRINTER OPTIONS "
470 PRINT "1[146] ENTIRE LIST OF FILES"
480 PRINT "2[146] INDIVIDUAL BOOKS DATA"
490 PRINT "3[146] INDIVIDUAL BOOKS"
500 PRINT "4[146] SINGLE PART OF FILE"
510 PRINT "5[146] RETURN TO PROGRAM"
520 GET Z$:IFZ$=""THEN 520
530 Z=VAL(Z$)
540 IFZ<1ORZ>5 THEN 460
550 OPEN1,4:RESTORE
560 ONZGOTO580,680,750,750
570 GOTO 80
580 READB$:IFB$<>"[220]"THEN580
590 READ B$:IFB$="[166]"THENCLOSE1:GOTO 80
600 IF B$="XX"THEN READA:PRINT#1,CHR$(10)CHR$(10)"ITEM";A:GOSUB 630:GOTO590
610 PRINT#1,B$
620 GOTO 590
630 READB$:FORI=1TO50
640 IFMID$(B$,I,1)=" "THEN X=I:I=50
650 NEXTI
660 N2$=LEFT$(B$,X):N1$=RIGHT$(B$,LEN(B$)-X):PRINT#1
670 PRINT#1,N1$;" ";N2$:RETURN
680 READB$:IFB$<>"[220]"THEN680
690 READB$:IFB$="[166]"THENCLOSE1:GOTO 80
700 IF B$<>"XX"THEN680
710 READA:PRINT#1,CHR$(10):GOSUB 630:GOSUB720:GOTO690
720 FOR I=1TO4:READA$(I):NEXT
730 PRINT#1,A$(1):PRINT#1A$(2);", ";A$(3);" ";A$(4)
740 RETURN
750 INPUT"[147]WHICH ITEM ";Q:RESTORE
760 READB$:IFB$<>"[220]"THEN 760
770 NEXTX:CLOSE1:GOTO 80
780 IFB$<>"XX"THENREADA:IFA=QTHEN800
790 GOTO 65535
800 PRINT#1,CHR$(10)CHR$(10)"ITEM";A:GOSUB630
810 IFZ=4THEN830
820 FORX=1TOR-1:READB$:PRINT#1,B$:NEXT:CLOSE1:GOTO460
830 GOSUB720:CLOSE1:GOTO460
840 DATA "[220]"
850 DATA"[166]", 1
860 DATA"[166]", 2
870 DATA"[166]", 3
880 DATA"[166]", 4
890 DATA"[166]", 5
900 DATA"[166]",6
910 DATA"[166]", 7
920 DATA"[166]", 8
930 DATA"[166]", 9
940 DATA"[166]", 10
950 DATA"[166]", 11
960 DATA"[166]", 12
970 DATA"[166]", 13
980 DATA"[166]", 14
990 DATA"[166]", 15
1000 DATA"[166]", 16
1010 DATA"[166]", 17
1020 DATA"[166]", 18
1030 DATA"[166]", 19
1040 DATA"[166]", 20
1050 DATA"[166]", 21
1060 DATA"[166]", 22
1070 DATA"[166]", 23
1080 DATA"[166]", 24
1090 DATA"[166]", 25
1100 DATA"[166]", 26
1110 DATA"[166]", 27
1120 DATA"[166]", 28
1130 DATA"[166]", 29
1140 DATA"[166]", 30
1150 DATA"[166]", 31
1160 DATA"[166]", 32
1170 DATA"[166]", 33
1180 DATA"[166]", 34
1190 DATA"[166]", 35
1200 DATA"[166]", 36
1210 DATA"[166]", 37
1220 DATA"[166]", 38
1230 DATA"[166]", 39
1240 DATA"[166]", 40
1250 DATA"[166]", 41
1260 DATA"[166]", 42
1270 DATA"[166]", 43
1280 DATA"[166]", 44
1290 DATA"[166]", 45
1300 DATA"[166]", 46
1310 DATA"[166]", 47
1320 DATA"[166]", 48
1330 DATA"[166]", 49
1340 DATA"[166]", 50
1350 DATA"[166]", 51
1360 DATA"[166]", 52
1370 DATA"[166]", 53
1380 DATA"[166]", 54
1390 DATA"[166]", 55
1400 DATA"[166]", 56
1410 DATA"[166]", 57
1420 DATA"[166]", 58
1430 DATA"[166]", 59
1440 DATA"[166]",60
1450 DATA"[166]",61
1460 DATA"[166]",62
1470 DATA"[166]",63
1480 DATA"[166]",64
1490 DATA"[166]",65
1500 DATA"[166]",66
1510 DATA"[166]",67
1520 DATA"[166]",68
1530 DATA"[166]",69
1540 DATA"[166]",70
1550 DATA"END"
1560 PRINT"[147]":GOSUB 1680:FORJ=1TO7:PRINT:NEXT:PRINTCHR$(05);CHR$(05):PRINTCHR$(142)
1570 POKE53281,0:A=1234:FORJ=0TO18:POKEA+J,127
1580 NEXT:FORJ=0TO10:POKEA+18+40*J,127
1590 NEXT:FORJ=0TO10:POKEA+40*J,127
1600 NEXT:FORJ=0TO18:POKEA+400+J,127
1610 FORJ=0TO18:POKEA+400+J,127:NEXT
1620 GOSUB 1680
1630 PRINTTAB(13);"[145][145][157]PATRICK GROTE
1640 [153][163]13);"CMDPROUDLY
1650 PRINTTAB(13);"[157]PRESENTS
1660 [153][163]13);"CMDCOM 64 BOOK SORT
1670 FORW=1TO4000:NEXT:GOTO 2060
1680 FORL=1TO1000:NEXT:RETURN
1690 PRINTCHR$(142):PRINT"[147]COM-64 MAIN MENU"
1700 PRINT"1. CREATE SUBJECTS
1710 [153]"2. IMMEDIATLEY BEGIN PROGRAM
1720 PRINT"3. RETURN TO INTRODUCTION
1730 [153]"4. TERMINATE PROGRAM
1740 GETA$:IFA$=""THEN1740
1750 IFA$="1"THEN 1790
1760 IFA$="2"THEN 30
1770 IFA$="3"THEN 2060
1780 IFA$="4"THEN SYS64738
1790 PRINT"[147]"
1800 INPUT"WHAT IS YOUR NAME";N$
1810 PRINT"[147]"
1820 PRINT"[145]DIRECTORY OF ";N$;"'S SUBJECTS :"
1830 PRINT"BELOW IS A LIST OF SUBJECTS FOR YOU TO"
1840 PRINT"SELECT FROM. PLEASE ";N$" CHOOSE SIX."
1850 PRINT"BIOLOGY","MATHMATICS"
1860 PRINT"COMPUTER SCIENCE";"ACCOUNTING"
1870 PRINT"BUSINESS";"THEOLOGY"
1880 PRINT"ENGINERING";"PHYSICS"
1890 PRINT"CHEMISTRY";"FORIEGN LANGUAGES"
1900 PRINT"EDUCATIONAL";"RECREATIONAL"
1910 PRINT"PLEASE INPUT SIX SUBJECTS ONE AT A TIME":INPUT U$,V$,W$,X$,Y$,Z$
1920 PRINT"ALL ARE THE ABOVE SATISFACTORY ?"
1930 GETS$:IFS$=""THEN 1930
1940 IFS$="N"THEN1910
1950 PRINT"[147]COM-64 SUB1 MENU"
1960 PRINT"1.";U$
1970 PRINT"2.";V$
1980 PRINT"3.";W$
1990 PRINT"4.";X$
2000 PRINT"5.";Y$
2010 PRINT"6.";Z$
2020 PRINT"WHICH TOPIC WOULD YOU LIKE "
2030 PRINT"TO CREATE A FILE FOR TODAY ";N$
2040 INPUT R
2050 PRINT"[144]":GOTO 30
2060 PRINT"[147]":PRINTCHR$(14):PRINTCHR$(8)
2070 PRINT"[147][212]O SKIP INSTRUCTIONS HIT 'S'"
2080 GETA$:IFA$=""THEN2080
2090 IFA$="S"THEN1690
2100 IFA$<>"S"THEN 2110
2110 PRINT"[147][145][145][145][201][206][212][210][207][196][213][195][212][201][207][206][160][212][207][160][195][207][205]-64 [194][207][207][203][160][211][207][210][212]"
2120 PRINT"[195][207][205]-64 [194][207][207][203] [211][207][210][212][146] WAS MADE FOR EVERYONE"
2130 PRINT"FROM THE VERY BUSY EXECUTIVE WHO WOULD"
2140 PRINT"LIKE TO FINALLY SORT ALL THE BOOKS OFF"
2150 PRINT"THAT DUSTY BOOK SHELF TO THE STUDIOUS"
2160 PRINT"STUDENT WHO HAS TO FIND THAT MATH BOOK"
2170 PRINT"IN THE PILES UPON PILES OF BOOKS. [206]O"
2180 PRINT"MATTER WHAT TYPE OR NUMBER OF BOOKS YOU"
2190 PRINT"HAVE TO BE SORTED, THE [195][207][205]-64 [194][207][207][203][160][211][207][210][212][146]"
2200 PRINT"CAN HANDLE THE JOB. [212]HIS SOFTWARE ALSO"
2210 PRINT"INCLUDES THE OPTION OF NOT JUST BEING"
2220 PRINT"ABLE TO PRINT THE WHOLE LIST, BUT TO "
2230 PRINT"BE ABLE TO PRINT SPECIFIED PARTS OR"
2240 PRINT"SECTIONS OF THE LIST."
2250 PRINT"PRESS SPACE BAR TO CONTINUE"
2260 GETA$:IFA$<>" "THEN2260
2270 PRINT"[147][208][193][199][197][160][207][206][197]"
2280 PRINT"[215]HEN USING THIS PROGRAM WE CAN KEEP IN"
2290 PRINT"MIND THE FAMOUS QUOTE FROM AN UNKNOWN"
2300 PRINT"AUTHOR, '[212]HE WILL TO PERSEVERE IS OFTEN"
2310 PRINT"THE DIFFFRENCE BETWEEN FAILURE AND THE "
2320 PRINT"ACHIEVMENT OF SUCCESS.[146]'"
2330 PRINT"[212]O APPLY THIS QUOTE TO SOFTWARE WILL DO"
2340 PRINT"YOU A WHOLE LOT OF GOOD. [198]OR IF YOU ARE"
2350 PRINT"GIVE-UP ON THIS SOFTWARE THEN YOU HAVE"
2360 PRINT"ACCOMPLISHED NOTHING,BUT IF ONE WERE TO"
2370 PRINT"PERSEVERE THROUGH THE TASKS HE WOULD"
2380 PRINT"ACCOMPLISH A WORLD OF GOOD FOR HIMSELF."
2390 PRINT"PRESS SPACE BAR TO CONTINUE"
2400 GETB$:IFB$<>" "THEN2400:END
2410 PRINT"[147][208][193][199][197][160][212][215][207]"
2420 PRINT"[206]OW WE WILL PREVIEW EACH COMMMAND ON"
2430 PRINT"THE BOOK SORT MENU OF[195][207][205]-64[160][194][207][207][203][160][211][207][210][212][146]:":FORT=1TO3000:NEXT
2440 PRINT"[193][196][196][160][193][160][194][207][207][203][146] [212]HIS COMMAND WILL"
2450 PRINT" ENABLE YOU TO ADD"
2460 PRINT" A BOOK TO YOUR DATA"
2470 PRINT" STATEMENTS."
2480 PRINT"[210][197][205][207][214][197][160][193][160][194][207][207][203][146] [212]HIS COMMAND WILL"
2490 PRINT" ERASE ANY ITEM FROM"
2500 PRINT" YOUR EXISTING DATA"
2510 PRINT" STATEMENTS."
2520 PRINT"[211][197][193][210][195][200][160][198][207][210][160][193][160][194][207][207][203][146] [212]HIS COMMAND WILL"
2530 PRINT" ALLOW YOU TO SEARCH"
2540 PRINT" FOR ANY BOOK BY THE"
2550 PRINT" WORDS YOU INPUT."
2560 PRINT"PRESS SPACE BAR TO CONTINUE[146]"
2570 GETA$:IFA$<>" "THEN 2570
2580 PRINT"[147]":PRINTTAB(30)"[145][208][193][199][197][160][212][200][210][197][197]"
2590 PRINT"CONTINUING......":FORT=1TO3000:NEXTT
2600 PRINT"[197][216][193][205][201][206][197][160][193][160][194][207][207][203][146] [212]HIS COMMAND WILL"
2610 PRINT"[145] ALLOW FOR YOU TO"
2620 PRINT" PEEK AT ANY ONE"
2630 PRINT" DATA STATEMENT."
2640 PRINT"[195][200][193][206][199][197][160][193][160][194][207][207][203][146] [212]HIS COMMAND WILL"
2650 PRINT"[145] ALLOW FOR YOU TO"
2660 PRINT" CHANGE ANY DATA "
2670 PRINT" STATEMENT THAT YOU
2680 [153]"ON WOULD LIKE TOO,BY"
2690 [153]" JUST PRESSING A "
2700 [153]" SINGLE BUTTON."
2710 [153]"PRESS SPACE BAR TO CONTINUE"
2720 [161]B$:[139]B$[179][177]" "[167]2720
2730 [153]"LOADCONTINUING....."
2740 [153]"ONONONON(null)ATNCHR$VALCLOSEASC(null)(null)(null)"
2750 [129]T[178]1[164]2000:[130]T
2760 [153]"(null)ATN(null)VALCLOSESTR$ATN(null)ATNCLOSE(null)(null)CLOSESTR$RIGHT$(null)(null)WAIT (null)HIS COMMAND WILL"
2770 [153]" ONALLOW THE USER TO"
2780 [153]" SAVE ANY NEW DATA"
2790 [153]" THAT HE/SHE HAS"
2800 [153]" ENTERED."
2810 [153]"(null)(null)RIGHT$(null)(null) STR$ATN(null)ATNCLOSE(null)(null)CLOSE(null)(null)RIGHT$(null)(null)VAL(null)WAIT (null)HIS COMMAND WILL"
2820 [153]"ON ALLOW THE USER"
2830 [153]" TO PRINT OUT THE"
2840 [153]" DIFFERNT TYPES"
2850 [153]" OF DATA."
2860 [153]"PRESS SPACE BAR TO CONTINUE"
2870 [161]B$:[139]B$[179][177]" "[167] 2870
2880 [153]"LOAD(null)ATNCHR$VALCLOSEASCRIGHT$(null)VAL"
2890 [153]" (null)HEN ENCOUNTER YOUR FIRST OPTION"
2900 [153]"MENU THERE WILL BE FOUR OPTIONS FOR YOU"
2910 [153]"TO CHOOSE FROM WE WILL DISCUSS ONE:"
2920 [153] "LEN(null)VALATN(null)VALCLOSE(null)(null)PEEKMID$VALLEN(null)(null)"
2930 [153] "(null)HIS WILL IMMEDIATLY PRINT A TABLE ON "
2940 [153]"THE SCREEN. ASCROM THIS YOU ARE ASKED TO "
2950 [153]"CHOOSE WHICH YOU WOULD LIKE AS SUBJECTS."
2960 [153]"ONATN MAXIMUM OF SIX MAY BE CHOOSEN, BUT YOU"
2970 [153]"ONMUST ENTER AT LEAST ONE, OR ELSE THE "
2980 [153]"PROGRAM WILL BE TERMINATED. PEEKY NO MEANS"
2990 [153]"ARE YOU FORCED TO USE THE SUBJECTS. (null)HE"
3000 [153]"SUBJECTS ARE THERE FOR SUGGESTION. RIGHT$F "
3010 [153]"YOU WOULD LIKE TO USE A SUBJECT NOT ON "
3020 [153]"THE TABLE, JUST ENTER THE SUBJECT(S) "
3030 [153]"THAT YOU WOULD LIKE."
3040 [153]"PRESS SPACE BAR TO CONTINUE"
3050 [161]B$:[139]B$[179][177]" "[167]3050
3060 [137] 1690